//
//  TextFontSetCell.m
//  GIFShow
//
//  Created by lanou11air029 on 15/4/23.
//  Copyright (c) 2015年 CK. All rights reserved.
//

#import "TextFontSetCell.h"


@interface TextFontSetCell ()
@property (nonatomic, strong) UIView * underView;
//@property (nonatomic, strong) UIStepper * textStepper;

@end
@implementation TextFontSetCell

- (void)awakeFromNib {
    // Initialization code
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        self.

        
        [self setupSubviews];
    }
    return self;
}
-(void)setupSubviews{
     CGRect screenBounds = [UIScreen mainScreen].bounds;
    CGFloat height = screenBounds.size.height;
    self.textTitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 100, height * 0.085)];
    self.textTitleLabel.text = @"文字大小";
    self.textTitleLabel.font = [UIFont systemFontOfSize:18];
    [self.contentView addSubview:self.textTitleLabel];
    self.underView = [[UIView alloc]initWithFrame:CGRectMake(0, self.textTitleLabel.frame.size.height + 5, screenBounds.size.width, height * 0.105)];
    [self.contentView addSubview:self.underView];
    self.instanceLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 100, height * 0.08)];
    [self.underView addSubview:self.instanceLabel];
    self.textStepper = [[UIStepper alloc]initWithFrame:CGRectMake(screenBounds.size.width - 110, (height * 0.085-25)*0.5, 100, 40)];

    self.textStepper.stepValue = 1;
    self.textStepper.minimumValue = 13;
    self.textStepper.maximumValue = 24;
    self.textStepper.value = 17;
    [self.underView addSubview:self.textStepper];
    self.textStepper.tintColor = [UIColor blackColor];
    self.instanceLabel.font = [UIFont systemFontOfSize:self.textStepper.value];
    self.instanceLabel.text = [NSString stringWithFormat:@"%@：%d",@"示例",(int)self.textStepper.value];

    
    
    self.underView.layer.cornerRadius = 7;
    self.underView.layer.borderWidth = 0.6;
    self.underView.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.contentView.clipsToBounds = YES;

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    CGFloat height = [UIScreen mainScreen].bounds.size.height;
    CGRect frame = self.contentView.frame;
    if(selected){
        frame.size.height = height*0.19+10;
        [UIView animateWithDuration:0.4 animations:^{
            self.contentView.frame = frame;
            self.contentView.backgroundColor = [UIColor colorWithRed:0.95 green:1 blue:0.95 alpha:0.9];
        }];
        self.contentView.clipsToBounds = YES;
    }else{
        frame.size.height = height*0.085;
        [UIView animateWithDuration:0.4 animations:^{
            self.contentView.frame = frame;
            self.contentView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:0.9];
        }];
        self.contentView.clipsToBounds = YES;
    }
    // Configure the view for the selected state
}

@end
